Tokens at the IXC ACS
Introduction
The IXC ACS authentication is based on JWTs (JSON Web Tokens), a self-contained form of token that loads on your payload a JavaScript object and a digital signature. The JWTs used in ACS are signed using ECDSA (Elliptic Curve Digital Signature Algorithm) keys.
Structure of a JWT
A JWT consists of three main parts:
- ** Head*: Contains information on the type of signature used in Token.
- Bodies: Stores data related to Token's creator user, its recipient and Token's own information.
- Signature: It contains a digital signature of the two previous parts of the Token.
The default format of a JWT is:
xxxxxx.yyyyyy.zzzzzzWhere: -xxxxxx: Basecoded Header64Url -yyyyyy: Body encoded in Base64Url -zzzzzz: Signature coded in Base64Url
I'll be right there # Detailing of JWT Parts
Header
eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9
* ```json
{
"alg": "ES256",
"typ": "JWT"
}-typ: Indicates that the document is of type JWT. -alg: Specifies the cryptographic algorithm used in the signature (always ES256 for Tokens of the IXC ACS API). Body
eyJpc3MiOiI2MTg1ODMyNGRlNmNlZjAwMTFmNTFiMDUiLCJleHAiOjE2MzgyMTU3MDgsImlhdCI6MTYzODIxNDcwOH0
* ```json
{
"iss": "61858324de6cef0011f51b05",
"exp": 1638215708,
"iat": 1638214708
}-iss: JWT Emitter Identifier (Client API ID). -exp: Token expiration timestamp UNIX. -iat: Token creation timestamp UNIX.
Signature
F1DRaeJcQ1oG8Nc33R0iSEBppEGFUQmLFKDzAaX3e9I2sTLZT0qOerw8nUhbcogAZsZpwQdQdAnU4B0SKIvBDA
The signature is automatically generated using the private key of the Token emitter.
# Process of Creation and Use of Token
1. Add the necessary data to Token's body.
2. Sign Token using the ES256 algorithm and its Private Key.
3. Use the generated Token to request an Access Token.
4. Send Token as Bearer Token to the API Authentication Endpoint.
# Security considerations
- What? Keep your private keys safe.
- Use HTTPS for all communications involving JWTs.
- What? Implement regular key rotation to increase security.
# Read it too
- [Preset no ACS](./preset%20no%20acs)
- [Projetos ACS](../projetos%20acs)
- [Protocolo TR-069](./protocolo%20tr-069)